﻿using Commons.Enums;
using DomainCommons.Models;
using Microsoft.AspNetCore.Identity;

namespace EntityModels.E02.Identities
{
    public class AppUser : IdentityUser<Guid>, IHasCreationTime, IHasDeletionTime, ISoftDelete,IEntity<Guid>
    {
        public Guid Avatar { get; set; }
        public string? NickName { get; set; }
        public string? Name { get; set; }

        public GenderEnum Sex { get; set; }
        public DateTime? Birthday { get; set; }
        public string? Description { get; set; }
        public DateTime CreationTime { get; set; }
        public DateTime? DeletionTime { get; private set; }
        public bool IsDeleted { get; private set; }
        public string? UserCode { get; set; }
        public AppUser()
        {
            this.CreationTime = DateTime.Now;
        }
        public AppUser(string userName) : base(userName)
        {
            this.CreationTime = DateTime.Now;
        }

        public void SoftDeleted()
        {
            this.DeletionTime = DateTime.Now;
            this.IsDeleted = true;
        }
    }
}
